# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - remove makedepend on python-pypandoc

pkgname=hid-tools
pkgver=0.7
pkgrel=2
arch=('any')
url='https://gitlab.freedesktop.org/libevdev/hid-tools'
license=('GPL2')
pkgdesc='Python scripts to manipulate HID data'
depends=('python-parse' 'python-pyudev' 'python-libevdev' 'python-click' 'python-yaml')
makedepends=('python-build' 'python-installer' 'python-hatchling' 'python-sphinx' 'python-sphinx_rtd_theme' 'python-sphinxcontrib-apidoc')
source=("$url/-/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('9a9bd42ac0a78455e7c5c472b954ac6761c656d51dc9667def50fd61311280d435b227c5b9519d05287063bbdfad3930598a9f0a8e4ffe4cc7cc1cda37c4462c')

build() {
  cd $pkgname-$pkgver

  python -m build -wnx

  cd doc/source

  sphinx-build -b html . _build
}

package() {
  cd $pkgname-$pkgver

  python -m installer --destdir="$pkgdir" dist/*.whl

  # Install documentation
  install -dm 755 "$pkgdir"/usr/share/doc/$pkgname/html
  cp -r -a --no-preserve=ownership doc/source/_build/* "$pkgdir"/usr/share/doc/$pkgname/html
}
